package com.agu.mgt.code.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.agu.utils.Query;

import java.util.List;
import java.util.Map;

import com.agu.mgt.code.dao.CodColumnDao;
import com.agu.entity.code.CodColumnEntity;
import com.agu.mgt.code.service.CodColumnService;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;


@Service("codColumnService")
@Transactional(readOnly = true)
public class CodColumnService{
	@Autowired
	private CodColumnDao codColumnDao;
	
	
	public CodColumnEntity queryObject(Long columnId){
		return codColumnDao.queryObject(columnId);
	}
	
	
	public List<CodColumnEntity> queryList(Map<String, Object> map){
		return codColumnDao.queryList(map);
	}

    
	public Page<CodColumnEntity> queryPageList(Query query){
	    PageHelper.startPage(query.getPage(), query.getLimit());
	    return codColumnDao.queryPageList(query);
	}
	
	
	public int queryTotal(Map<String, Object> map){
		return codColumnDao.queryTotal(map);
	}
	
	
	@Transactional
	public void save(CodColumnEntity codColumn){
		codColumnDao.save(codColumn);
	}
	
	
	@Transactional
	public void update(CodColumnEntity codColumn){
		codColumnDao.update(codColumn);
	}
	
	
	@Transactional
	public void delete(Long columnId){
		codColumnDao.delete(columnId);
	}
	
	
	@Transactional
	public void deleteBatch(Long[] columnIds){
		codColumnDao.deleteBatch(columnIds);
	}
}
